# This makefile doesn't use pattern matching

# Configuring
CC= gcc
LD= gcc
CFLAGS= -c -Wall -Wextra -pedantic
LDFLAGS=  
LDLIBS= 

# Sources
SRCS= main.c base.c utils.c

# Objects
OBJS= $(SRCS:.c=.o)

# Targets
all: myapp.x

myapp.x: $(OBJS)
	@echo Linking $@
	@$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

clean:
	@rm *.o myapp.x

# Compiling
main.o: main.c mylib.h
	@echo $@
	$(CC) $(CFLAGS) -o $@ $<

base.o: base.c base.h
	@echo $@
	$(CC) $(CFLAGS) -o $@ $<
	
utils.o: utils.c utils.h
	@echo $@
	$(CC) $(CFLAGS) -o $@ $<

.PHONY: all clean